package com.orangeforms.webadmin.app.model;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.orangeforms.application.common.constant.DeviceType;
import com.orangeforms.common.core.annotation.RelationConstDict;
import com.orangeforms.common.core.annotation.RelationDict;
import com.orangeforms.common.core.annotation.UploadFlagColumn;
import com.orangeforms.common.core.base.mapper.BaseModelMapper;
import com.orangeforms.common.core.upload.UploadStoreTypeEnum;
import com.orangeforms.webadmin.app.vo.PaperExerciseTransVo;
import com.orangeforms.webadmin.upms.model.SysDept;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Date;
import java.util.Map;

/**
 * (PaperExerciseTrans)表实体类
 *
 * @author makejava
 * @since 2022-06-02 16:28:27
 */
@Data
@TableName(value = "paper_exercise_trans")
public class PaperExerciseTrans {
     /**
     * 主键Id
     */
    @TableId(value = "trans_id")
    private Long transId;

     /**
     * 学生Id
     */
    @TableField(value = "student_id")
    private Long studentId;

     /**
     * 学生姓名
     */
     @TableField(value = "student_name")
    private String studentName;

     /**
     * 校区
     */
     @TableField(value = "school_id")
    private Long schoolId;

     /**
     * 作业Id
     */
     @TableField(value = "paper_id")
    private Long paperId;

     /**
     * 习题Id
     */
     @TableField(value = "exercise_id")
    private Long exerciseId;

     /**
     * 设备类型(0: iOS 1: Android 2: PC)
     */
     @TableField(value = "device_type")
    private Integer deviceType;

     /**
     * 是否正确(0: 不正确 1: 正确)
     */
     @TableField(value = "correct_flag")
    private Integer correctFlag;

     /**
     * 所用秒数
     */
     @TableField(value = "used_seconds")
    private Integer usedSeconds;

     /**
     * 提交时间
     */
    @TableField(value = "commit_time")
    private Date commitTime;

    /**
     * 文件
     */
    @UploadFlagColumn(storeType = UploadStoreTypeEnum.LOCAL_SYSTEM)
    @TableField(value = "document")
    private String document;

    /**
     * birthday 范围过滤起始值(>=)。
     */
    @TableField(exist = false)
    private String commitTimeStart;

    /**
     * birthday 范围过滤结束值(<=)。
     */
    @TableField(exist = false)
    private String commitTimeEnd;

    /**
     * 字典-1
     */
    @RelationDict(
            masterIdField = "schoolId",
            slaveServiceName = "sysDeptService",
            slaveModelClass = SysDept.class,
            slaveIdField = "deptId",
            slaveNameField = "deptName")
    @TableField(exist = false)
    private Map<String, Object> schoolIdDictMap;

    /**
     * 字典-2
     */
    @RelationConstDict(
            masterIdField = "deviceType",
            constantDictClass = DeviceType.class)
    @TableField(exist = false)
    private Map<String,Object> deviceTypeDictMap;


    @Mapper
    public interface PaperExerciseTransModelMapper extends BaseModelMapper<PaperExerciseTransVo,PaperExerciseTrans>{

        /**
         * 转换Vo对象到实体对象。
         *
         * @param paperExerciseTransVo 域对象。
         * @return 实体对象。
         */
        @Override
        PaperExerciseTrans toModel(PaperExerciseTransVo paperExerciseTransVo);

        /**
         * 转换实体对象到VO对象。
         *
         * @param paperExerciseTrans 实体对象。
         * @return 域对象。
         */
        @Override
        PaperExerciseTransVo fromModel(PaperExerciseTrans paperExerciseTrans);
    }

    public static final PaperExerciseTransModelMapper INSTANCE = Mappers.getMapper(PaperExerciseTransModelMapper.class);

}

